// 动画特效展示
package main

import (
	_ "embed"
	"fmt"
	font "gitee.com/go_888/xcgui/xcgui/font"

	ani "gitee.com/go_888/xcgui/xcgui/ani"
	app "gitee.com/go_888/xcgui/xcgui/app"
	widget "gitee.com/go_888/xcgui/xcgui/widget"
	window "gitee.com/go_888/xcgui/xcgui/window"
	xc "gitee.com/go_888/xcgui/xcgui/xc"
	xcc "gitee.com/go_888/xcgui/xcgui/xcc"
)

var (
	a *app.X结构_全局API
	w *window.Window

	list_svg       []int
	list_animation []int
	list_xcgui     []int

	m_hLayout1 int
	m_hLayout2 int
	m_hLayout3 int

	m_hSvg int
)

var (
	//go:embed svg/公益.svg
	svg1 string
	//go:embed svg/时间戳.svg
	svg2 string
	//go:embed svg/技术服务.svg
	svg3 string
	//go:embed svg/底层架构.svg
	svg4 string
	//go:embed svg/查验.svg
	svg5 string
	//go:embed svg/接口配置.svg
	svg6 string
	//go:embed svg/淘公仔文字.svg
	svg7 string

	//go:embed image/img-1.jpg
	img1 []byte
	//go:embed image/img-2.jpg
	img2 []byte
	//go:embed image/img-3.jpg
	img3 []byte
	//go:embed image/img-4.jpg
	img4 []byte
	//go:embed image/img-5.jpg
	img5 []byte
	//go:embed image/img-6.jpg
	img6 []byte

	svg11 = `<svg x="0" y="0" width="25" height="25" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#ee6362" /></svg>`
	svg12 = `<svg x="0" y="0" width="25" height="25" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#2cb0b2" /></svg>`
	svg13 = `<svg x="0" y="0" width="20" height="20" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#f00" /></svg>`
	svg14 = `<svg x="0" y="0" width="15" height="15" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#f00" /></svg>`
	svg15 = `<svg viewBox="0 0 200 200"><circle cx="100" cy="100" r="100" fill="#ff0" /></svg>`
)

func main() {
	a = app.X创建(true)
	a.X启用DPI(true)
	a.X启用自动DPI(true)
	a.X设置绘制频率(10)
	// a.ShowLayoutFrame(true).ShowSvgFrame(true)
	// 创建窗口
	w = window.X创建窗口(0, 0, 1020, 650, "炫彩界面库-动画特效-SVG特效", 0, xcc.X窗口样式_默认样式)

	// 创建按钮, 注册按钮单击事件
	var top int32 = 35
	var left int32 = 10
	CreateButtonRadio(left, &top, "1.下落 缩放 缓动").X事件_被单击(OnBtnClick1)
	CreateButtonRadio(left, &top, "2.下落 呼吸SVG").X事件_被单击(OnBtnClick2)
	CreateButtonRadio(left, &top, "3.呼吸SVG").X事件_被单击(OnBtnClick3)
	CreateButtonRadio(left, &top, "4.不透明度SVG").X事件_被单击(OnBtnClick4)
	CreateButtonRadio(left, &top, "5.移动SVG").X事件_被单击(OnBtnClick5)
	CreateButtonRadio(left, &top, "6.形状文本").X事件_被单击(OnBtnClick6)
	CreateButtonRadio(left, &top, "7.按钮").X事件_被单击(OnBtnClick7)
	CreateButtonRadio(left, &top, "8.布局焦点展开").X事件_被单击(OnBtnClick8)
	CreateButtonRadio(left, &top, "9.图片切换").X事件_被单击(OnBtnClick9)
	CreateButtonRadio(left, &top, "10.图片切换2").X事件_被单击(OnBtnClick10)
	CreateButtonRadio(left, &top, "11.进度 等待").X事件_被单击(OnBtnClick11)
	CreateButtonRadio(left, &top, "12.旋转 移动").X事件_被单击(OnBtnClick12)
	CreateButtonRadio(left, &top, "13.旋转 摇摆").X事件_被单击(OnBtnClick13)
	CreateButtonRadio(left, &top, "14.旋转 移动 缩放").X事件_被单击(OnBtnClick14)
	CreateButtonRadio(left, &top, "15.旋转 开合效果").X事件_被单击(OnBtnClick15)
	CreateButtonRadio(left, &top, "16.颜色渐变").X事件_被单击(OnBtnClick16)
	CreateButtonRadio(left, &top, "17.缩放 位置").X事件_被单击(OnBtnClick17)
	CreateButtonRadio(left, &top, "18.按钮 宽度").X事件_被单击(OnBtnClick18)

	top = 35
	left = 900
	CreateButtonRadio(left, &top, "19.窗口特效").X事件_被单击(OnBtnClick19)
	CreateButtonRadio(left, &top, "20.遮盖弹窗").X事件_被单击(OnBtnClick20)
	// TODO
	/*CreateButtonRadio(left, &top, "21.通知消息").Event_BnClick(OnBtnClick19)
	CreateButtonRadio(left, &top, "22.进度条").Event_BnClick(OnBtnClick19)
	CreateButtonRadio(left, &top, "23.焦点追踪").Event_BnClick(OnBtnClick19)
	CreateButtonRadio(left, &top, "24.页面切换 滑动").Event_BnClick(OnBtnClick19)
	CreateButtonRadio(left, &top, "25.折叠面板").Event_BnClick(OnBtnClick19)
	CreateButtonRadio(left, &top, "26.图片轮播").Event_BnClick(OnBtnClick19)
	CreateButtonRadio(left, &top, "27.背景管理器").Event_BnClick(OnBtnClick19)*/

	w.X事件_绘制(OnWndDrawWindow)
	w.X显示方式(xcc.SW_SHOW)
	a.X运行()
	ReleaseAnimation()
	a.X退出()
}

// 创建单选按钮
func CreateButtonRadio(left int32, top *int32, name string) *widget.X结构_按钮 {
	btn := widget.X创建按钮(left, *top, 110, 30, name, w.X句柄)
	btn.X设置文本对齐(xcc.X文本对齐_左对齐 | xcc.X文本对齐_垂直居中)
	btn.X设置类型EX(xcc.X对象扩展类型_单选按钮)
	btn.X设置组ID(1)
	*top += 29
	return btn
}

// 创建按钮
func CreateButton(left, top, width, height int32, name string) *widget.X结构_按钮 {
	btn := widget.X创建按钮(left, top, width, height, name, w.X句柄)
	btn.X设置文本对齐(xcc.X文本对齐_左对齐 | xcc.X文本对齐_垂直居中)
	btn.X设置内填充大小(10, 0, 0, 0)
	return btn
}

// 释放资源
func ReleaseAnimation() {
	for _, v := range list_animation {
		xc.X动画_释放(v, true)
	}

	for _, v := range list_svg {
		xc.SVG_释放引用计数(v)
	}

	for _, v := range list_xcgui {
		t := xc.X炫彩对象_取基础类型(v)
		switch t {
		case xcc.X对象句柄类型_基础元素:
			xc.X元素_销毁(v)
		case xcc.X对象句柄类型_形状:
			xc.X形状_销毁(v)
		case xcc.X对象句柄类型_SVG矢量图形:
			xc.SVG_释放引用计数(v)
		}
	}

	list_animation = list_animation[:0]
	list_svg = list_svg[:0]
	list_xcgui = list_xcgui[:0]
}

// 窗口绘制消息.
func OnWndDrawWindow(hDraw int, pbHandled *bool) int {
	*pbHandled = true
	w.X绘制(hDraw)

	if m_hSvg != 0 {
		xc.X绘制_SVG源(hDraw, m_hSvg)
	}

	for _, v := range list_svg {
		xc.X绘制_SVG源(hDraw, v)
	}
	return 0
}

// 1.下落 缩放 缓动
func OnBtnClick1(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 130
	var top int32 = 22

	// 加载svg图片
	list_svg = append(list_svg,
		xc.SVG_加载从文本W(svg1),
		xc.SVG_加载从文本W(svg2),
		xc.SVG_加载从文本W(svg3),
		xc.SVG_加载从文本W(svg4),
		xc.SVG_加载从文本W(svg5),
		xc.SVG_加载从文本W(svg6),
	)

	// 创建动画组
	hGroup := xc.X动画组_创建(0)
	list_animation = append(list_animation, hGroup)
	xc.X动画_运行(hGroup, w.X句柄)

	for i, hSvg := range list_svg {
		// 设置svg图片大小和位置
		xc.SVG_设置大小(hSvg, 100, 100)
		xc.SVG_设置偏移(hSvg, left, top)

		// 创建动画序列
		hAnimation := xc.X动画_创建动画序列(hSvg, 0)
		// 将动画序列添加到动画组中
		xc.X动画组_添加项(hGroup, hAnimation)

		xc.X动画_移动(hAnimation, 500, float32(left), 22, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
		xc.X动画_延迟(hAnimation, 500)

		xc.X动画_延迟(hAnimation, 100*float32(i))
		xc.X动画_透明度(hAnimation, 500, 0, 1, 0, false)

		xc.X动画_延迟(hAnimation, 500)

		xc.X动画_透明度(hAnimation, 500, 255, 1, 0, false)
		xc.X动画_延迟(hAnimation, 1000)

		xc.X动画_移动(hAnimation, 2000, float32(left), 500, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
		xc.X动画_延迟(hAnimation, 1000)
		left += 130
		{
			hAnimation = xc.X动画_创建动画序列(hSvg, 0)
			xc.X动画_延迟(hAnimation, 6000+float32(i)*200)
			xc.X动画_缩放(hAnimation, 1200, 2, 2, 1, xcc.X缓动标识_三次方|xcc.X缓动标识_慢到快, true)

			xc.X动画组_添加项(hGroup, hAnimation)
		}
	}
	return 0
}

// 2.下落 呼吸SVG
func OnBtnClick2(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 450
	var top int32 = 22

	// 加载svg图片
	list_svg = append(list_svg, xc.SVG_加载从文本W(svg1))
	// 设置svg图片大小和位置
	xc.SVG_设置大小(list_svg[0], 100, 100)
	xc.SVG_设置偏移(list_svg[0], left, top)

	// 创建动画组
	group := ani.X创建动画组(0)
	list_animation = append(list_animation, group.X句柄)
	group.X运行(w.X句柄)

	// 下落
	ani1 := ani.X创建动画序列(list_svg[0], 0)
	group.X添加项(ani1.X句柄)
	{
		ani1.X移动(2000, float32(left), 500, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
		// 停留
		ani1.X延迟(2000)
		// 返回顶部
		ani1.X移动(500, float32(left), 22, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
	}

	// 缩放
	ani2 := ani.X创建动画序列(list_svg[0], 1)
	group.X添加项(ani2.X句柄)
	{
		ani2.X延迟(2000)
		ani2.X缩放(1000, 2, 2, 0, xcc.X缓动标识_三次方|xcc.X缓动标识_慢到快, true)
	}

	/* 以下是纯函数方式实现
		// 创建动画组
	   	hGroup := xc.XAnimaGroup_Create(0)
	   	list_animation = append(list_animation, hGroup)
	   	xc.XAnima_Run(hGroup, w.Handle)

	   	// 下落
	   	hAnimation := xc.XAnima_Create(list_svg[0], 0)
	   	xc.XAnimaGroup_AddItem(hGroup, hAnimation)
	   	xc.XAnima_Move(hAnimation, 2000, float32(left), 500, 1, xcc.Ease_Flag_Bounce|xcc.Ease_Flag_Out, false)

	   	// 停留
	   	xc.XAnima_Delay(hAnimation, 2000)

	   	// 返回顶部
	   	xc.XAnima_Move(hAnimation, 500, float32(left), 22, 1, xcc.Ease_Flag_Bounce|xcc.Ease_Flag_Out, false)

	   	// 缩放
	   	hAnimation = xc.XAnima_Create(list_svg[0], 1)
	   	xc.XAnimaGroup_AddItem(hGroup, hAnimation)

	   	xc.XAnima_Delay(hAnimation, 2000)
	   	xc.XAnima_Scale(hAnimation, 1000, 2, 2, 0, xcc.Ease_Flag_Cubic|xcc.Ease_Flag_In, true)
	*/
	return 0
}

// 3.呼吸SVG
func OnBtnClick3(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 300
	var top int32 = 150

	// 加载svg图片
	list_svg = append(list_svg, xc.SVG_加载从文本W(svg1))
	// 设置svg图片大小和位置
	xc.SVG_设置大小(list_svg[0], 300, 300)
	xc.SVG_设置偏移(list_svg[0], left, top)

	// 创建动画序列
	ani1 := ani.X创建动画序列(list_svg[0], 1)
	list_animation = append(list_animation, ani1.X句柄)

	// 缩放
	ani1.X缩放(1500, 2, 2, 0, xcc.X缓动标识_二次方|xcc.X缓动标识_慢到快, true)
	ani1.X运行(w.X句柄)

	/* 以下是纯函数方式实现
		// 创建动画序列
	   	hAnimation := xc.XAnima_Create(list_svg[0], 1)
	   	list_animation = append(list_animation, hAnimation)

	   	// 缩放
	   	xc.XAnima_Scale(hAnimation, 1500, 2, 2, 0, xcc.Ease_Flag_Quad|xcc.Ease_Flag_In, true)
	   	xc.XAnima_Run(hAnimation, w.Handle)
	*/
	return 0
}

// 4.不透明度SVG
func OnBtnClick4(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 200
	var top int32 = 30

	// 加载svg图片
	list_svg = append(list_svg,
		xc.SVG_加载从文本W(svg1),
		xc.SVG_加载从文本W(svg1),
		xc.SVG_加载从文本W(svg1),
	)

	// 设置svg图片大小和位置
	for i, hSvg := range list_svg {
		xc.SVG_设置大小(hSvg, 100, 100)
		xc.SVG_设置偏移(hSvg, left+int32(i)*100, top)
	}

	// 创建动画序列
	hAnimation := xc.X动画_创建动画序列(list_svg[0], 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_透明度EX(hAnimation, 3000, 0, 255, 1, 0, false)
	xc.X动画_运行(hAnimation, w.X句柄)

	hAnimation = xc.X动画_创建动画序列(list_svg[1], 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_透明度(hAnimation, 3000, 0, 1, 0, true)
	xc.X动画_运行(hAnimation, w.X句柄)

	hAnimation = xc.X动画_创建动画序列(list_svg[2], 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_透明度(hAnimation, 3000, 0, 0, 0, true)
	xc.X动画_运行(hAnimation, w.X句柄)

	{
		top = 100
		m_hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, m_hSvg)
		xc.SVG_设置偏移(m_hSvg, left, top)

		hAnimation = xc.X动画_创建动画序列(m_hSvg, 0)
		list_animation = append(list_animation, hAnimation)

		xc.X动画_透明度(hAnimation, 3000, 0, 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top += 150
		m_hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, m_hSvg)
		xc.SVG_设置偏移(m_hSvg, left, top)

		hAnimation = xc.X动画_创建动画序列(m_hSvg, 0)
		list_animation = append(list_animation, hAnimation)

		xc.X动画_透明度EX(hAnimation, 3000, 255, 50, 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top += 150
		m_hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, m_hSvg)
		xc.SVG_设置偏移(m_hSvg, left, top)

		hAnimation = xc.X动画_创建动画序列(m_hSvg, 0)
		list_animation = append(list_animation, hAnimation)

		xc.X动画_透明度EX(hAnimation, 3000, 50, 255, 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	return 0
}

// 5.移动SVG
func OnBtnClick5(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 150
	var top int32 = 30

	// 加载svg图片
	list_svg = append(list_svg,
		xc.SVG_加载从文本W(svg1),
		xc.SVG_加载从文本W(svg2),
		xc.SVG_加载从文本W(svg3),
	)

	// 设置svg图片大小和位置
	for i, hSvg := range list_svg {
		xc.SVG_设置大小(hSvg, 100, 100)
		xc.SVG_设置偏移(hSvg, left, top+int32(i)*100)
	}
	top = 22

	// 循环
	ani1 := ani.X创建动画序列(list_svg[0], 1)
	list_animation = append(list_animation, ani1.X句柄)
	ani1.X运行(w.X句柄)
	ani1.X移动(2000, 750, float32(top), 10, 0, true)
	top += 100

	// 一次, 往返
	ani2 := ani.X创建动画序列(list_svg[1], 1)
	list_animation = append(list_animation, ani2.X句柄)
	ani2.X运行(w.X句柄)
	ani2.X移动(2000, 750, float32(top), 1, 0, true)
	top += 100

	// 一次, 不往返
	ani3 := ani.X创建动画序列(list_svg[2], 1)
	list_animation = append(list_animation, ani3.X句柄)
	ani3.X运行(w.X句柄)
	ani3.X移动(2000, 750, float32(top), 1, 0, false)
	top += 100

	/* 以下是纯函数方式实现
	// 循环
	hAnimation := xc.XAnima_Create(list_svg[0], 1)
	list_animation = append(list_animation, hAnimation)
	xc.XAnima_Run(hAnimation, w.Handle)
	xc.XAnima_Move(hAnimation, 2000, 750, float32(top), 10, 0, true)
	top += 100

	// 一次, 往返
	hAnimation = xc.XAnima_Create(list_svg[1], 1)
	list_animation = append(list_animation, hAnimation)
	xc.XAnima_Run(hAnimation, w.Handle)
	xc.XAnima_Move(hAnimation, 2000, 750, float32(top), 1, 0, true)
	top += 100

	// 一次, 不往返
	hAnimation = xc.XAnima_Create(list_svg[2], 1)
	list_animation = append(list_animation, hAnimation)
	xc.XAnima_Run(hAnimation, w.Handle)
	xc.XAnima_Move(hAnimation, 2000, 750, float32(top), 1, 0, false)
	*/
	return 0
}

// 6.形状文本
func OnBtnClick6(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 140
	var top int32 = 100

	// 创建形状文本
	hShapeText1 := xc.X形状文本_创建(left, top, 100, 30, "循环滚动", w.X句柄)
	top += 50
	hShapeText2 := xc.X形状文本_创建(left, top, 100, 30, "往返滚动", w.X句柄)
	top += 50
	hShapeText3 := xc.X形状文本_创建(left, top, 100, 30, "移动到末尾", w.X句柄)
	top += 50
	list_xcgui = append(list_xcgui,
		hShapeText1,
		hShapeText2,
		hShapeText3,
	)
	top = 100

	ani1 := ani.X创建动画序列(hShapeText1, 0)
	list_animation = append(list_animation, ani1.X句柄)
	ani1.X运行(w.X句柄)
	ani1.X移动(3000, 750, float32(top), 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, true)

	ani2 := ani.X创建动画序列(hShapeText2, 1)
	list_animation = append(list_animation, ani2.X句柄)
	ani2.X运行(w.X句柄)
	ani2.X移动(3000, 750, float32(top+50), 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, true)

	ani3 := ani.X创建动画序列(hShapeText3, 1)
	list_animation = append(list_animation, ani3.X句柄)
	ani3.X运行(w.X句柄)
	ani3.X移动(1500, 750, float32(top+100), 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)

	/* 	以下是纯函数方式实现
	hAnimation := xc.XAnima_Create(hShapeText1, 0)
	list_animation = append(list_animation, hAnimation)
	xc.XAnima_Run(hAnimation, w.Handle)
	xc.XAnima_Move(hAnimation, 3000, 750, float32(top), 1, xcc.Ease_Flag_Bounce|xcc.Ease_Flag_Out, true)

	hAnimation = xc.XAnima_Create(hShapeText2, 1)
	list_animation = append(list_animation, hAnimation)
	xc.XAnima_Run(hAnimation, w.Handle)
	xc.XAnima_Move(hAnimation, 3000, 750, float32(top+50), 1, xcc.Ease_Flag_Bounce|xcc.Ease_Flag_Out, true)

	hAnimation = xc.XAnima_Create(hShapeText3, 1)
	list_animation = append(list_animation, hAnimation)
	xc.XAnima_Run(hAnimation, w.Handle)
	xc.XAnima_Move(hAnimation, 1500, 750, float32(top+100), 1, xcc.Ease_Flag_Bounce|xcc.Ease_Flag_Out, false)
	*/
	return 0
}

// 7.按钮
func OnBtnClick7(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 125
	var top int32 = 50

	{
		group1 := ani.X创建动画组(0)
		list_animation = append(list_animation, group1.X句柄)
		group1.X运行(w.X句柄)
		for i := 0; i < 13; i++ {
			hButton := xc.X按钮_创建(left, top, 60, 30, "透明度", w.X句柄)
			list_xcgui = append(list_xcgui, hButton)

			hAnimation := xc.X动画_创建动画序列(hButton, 0)
			group1.X添加项(hAnimation)

			xc.X动画_延迟(hAnimation, 500)

			xc.X动画_延迟(hAnimation, 100*float32(i))
			xc.X动画_透明度EX(hAnimation, 1200, 255, 20, 1, 0, true)
			left += 61
		}
	}

	left = 125
	top = 100
	group2 := ani.X创建动画组(0)
	list_animation = append(list_animation, group2.X句柄)
	group2.X运行(w.X句柄)
	for i := 0; i < 7; i++ {
		hButton := xc.X按钮_创建(left, top, 80, 30, "循环滚动", w.X句柄)
		list_xcgui = append(list_xcgui, hButton)

		{
			hAnimation := xc.X动画_创建动画序列(hButton, 0)
			group2.X添加项(hAnimation)

			xc.X动画_移动(hAnimation, 500, float32(left), float32(top), 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
			xc.X动画_延迟(hAnimation, 500)

			xc.X动画_延迟(hAnimation, 100*float32(i))
			xc.X动画_透明度EX(hAnimation, 500, 255, 0, 1, 0, false)

			xc.X动画_延迟(hAnimation, 500)

			xc.X动画_透明度EX(hAnimation, 500, 0, 255, 1, 0, false)
			xc.X动画_延迟(hAnimation, 1000)

			xc.X动画_移动(hAnimation, 2000, float32(left), 500, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
			xc.X动画_延迟(hAnimation, 1000)
		}
		{
			hAnimation := xc.X动画_创建动画序列(hButton, 1)
			xc.X动画组_添加项(group2.X句柄, hAnimation)
			xc.X动画_延迟(hAnimation, 6000+float32(i)*200)
			xc.X动画_缩放(hAnimation, 1200, 1.5, 2, 1, xcc.X缓动标识_三次方|xcc.X缓动标识_慢到快, true)
		}
		left += 110
	}
	return 0
}

// 8.布局焦点展开
func OnBtnClick8(pbHandled *bool) int {
	ReleaseAnimation()

	hLayout := xc.X布局_创建(140, 100, 750, 100, w.X句柄)
	xc.X布局盒子_设置间距(hLayout, 20)
	list_xcgui = append(list_xcgui, hLayout)

	for i := 0; i < 3; i++ {
		hLayout_ := xc.X布局_创建(0, 0, 100, 100, hLayout)
		xc.X元素_设置内填充大小(hLayout_, 10, 0, 10, 0)

		hShapeText := xc.X形状文本_创建(0, 0, 100, 100, "炫彩界面库-www.xcgui.com-鼠标移动到上面查看", hLayout_)
		xc.X形状文本_设置文本颜色(hShapeText, xc.RGBA颜色(255, 255, 255, 255))
		xc.X窗口组件_布局项_设置宽度(hShapeText, xcc.X布局大小类型_填充父, 0)

		list_xcgui = append(list_xcgui, hLayout_)
		xc.X元素_启用鼠标穿透(hLayout_, false)
		xc.X窗口组件_布局项_设置宽度(hLayout_, xcc.X布局大小类型_按比例分配, 100)

		xc.X背景_设置内容(xc.X元素_取背景管理器(hLayout_), "{99:1.9.9;98:16(0);5:2(15)20(1)21(3)26(1)22(-7839744)23(255)9(5,5,5,5);}")
		xc.X元素_注册事件C1(hLayout_, xcc.X元素事件_鼠标_进入, OnMouseStay8)
		xc.X元素_注册事件C1(hLayout_, xcc.X元素事件_鼠标_离开, OnMouseLeave8)

		switch i {
		case 0:
			m_hLayout1 = hLayout_
		case 1:
			m_hLayout2 = hLayout_
		case 2:
			m_hLayout3 = hLayout_
		}
	}

	xc.X窗口_调整布局(w.X句柄)
	w.X重绘(false)
	return 0
}

// 鼠标进入事件8
func OnMouseStay8(hLayout int, pbHandled *bool) int {
	if m_hLayout1 != hLayout {
		xc.X元素_设置透明度(m_hLayout1, 200)
	}

	if m_hLayout2 != hLayout {
		xc.X元素_设置透明度(m_hLayout2, 200)
	}

	if m_hLayout3 != hLayout {
		xc.X元素_设置透明度(m_hLayout3, 200)
	}

	hAnimation := xc.X动画_创建动画序列(hLayout, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_布局宽度(hAnimation, 300, xcc.X布局大小类型_按比例分配, 200, 1, 0, false)
	xc.X动画_运行(hAnimation, w.X句柄)
	return 0
}

// 鼠标离开事件8
func OnMouseLeave8(hLayout, hEleStay int, pbHandled *bool) int {
	hAnimation := xc.X动画_创建动画序列(hLayout, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_布局宽度(hAnimation, 300, xcc.X布局大小类型_按比例分配, 100, 1, 0, false)
	xc.X动画_运行(hAnimation, w.X句柄)

	xc.X元素_设置透明度(m_hLayout1, 255)
	xc.X元素_设置透明度(m_hLayout2, 255)
	xc.X元素_设置透明度(m_hLayout3, 255)
	return 0
}

// 9.图片切换 - 两个基础元素透明度切换
func OnBtnClick9(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 150
	var top int32 = 50

	imgMap := map[int][]byte{
		1: img1,
		2: img2,
		3: img3,
		4: img4,
		5: img5,
		6: img6,
	}

	for i := 0; i < 3; i++ {
		hImage := xc.X图片_加载从内存(imgMap[i*2+1])
		xc.X图片_设置绘制类型(hImage, xcc.X图片绘制类型_固定比例)

		hEle := xc.X元素_创建(left, top, 211, 270, w.X句柄)
		xc.X元素_添加背景图片(hEle, xcc.X组合状态_元素_鼠标离开, hImage)
		list_xcgui = append(list_xcgui, hEle)

		hImage2 := xc.X图片_加载从内存(imgMap[i*2+2])
		xc.X图片_设置绘制类型(hImage2, xcc.X图片绘制类型_固定比例)

		hEle2 := xc.X元素_创建(left, top, 211, 270, w.X句柄)
		xc.X元素_添加背景图片(hEle2, xcc.X组合状态_元素_鼠标离开, hImage2)
		list_xcgui = append(list_xcgui, hEle2)

		xc.X元素_设置用户数据(hEle, hEle2)
		xc.X元素_设置用户数据(hEle2, hEle)
		xc.X窗口组件_显示(hEle2, false)

		hText := xc.X形状文本_创建(left, top+280, 200, 40, "炫彩界面库-图片切换\r\n$66.66", w.X句柄)
		xc.X形状文本_设置文本颜色(hText, xc.RGBA颜色(80, 80, 80, 255))
		list_xcgui = append(list_xcgui, hText)

		xc.X元素_注册事件C1(hEle, xcc.X元素事件_鼠标_进入, OnMouseStay9)
		xc.X元素_注册事件C1(hEle2, xcc.X元素事件_鼠标_离开, OnMouseLeave9)

		left += 211 + 10
	}
	w.X重绘(false)
	return 0
}

// 鼠标进入事件9
func OnMouseStay9(hEle int, pbHandled *bool) int {
	hEle2 := xc.X元素_取用户数据(hEle)
	// 释放当前对象关联的动画
	for i := len(list_animation) - 1; i >= 0; i-- {
		hObjectUI := xc.X动画_取UI对象(list_animation[i])
		if hEle == hObjectUI || hEle2 == hObjectUI {
			xc.X动画_释放(list_animation[i], false)
			list_animation = append(list_animation[:i], list_animation[i+1:]...)
		}
	}

	hAnimation := xc.X动画_创建动画序列(hEle, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_运行(hAnimation, hEle)
	xc.X动画_透明度EX(hAnimation, 1000, 255, 0, 1, 0, false)
	xc.X动画_显示(hAnimation, 0, false)

	xc.X元素_设置透明度(hEle2, 0)
	xc.X窗口组件_显示(hEle2, true)

	hAnimation = xc.X动画_创建动画序列(hEle2, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_运行(hAnimation, hEle2)
	xc.X动画_延迟(hAnimation, 500)
	xc.X动画_透明度EX(hAnimation, 1000, 0, 255, 1, 0, false)
	return 0
}

// 鼠标离开事件9
func OnMouseLeave9(hEle2, hEleStay int, pbHandled *bool) int {
	hEle := xc.X元素_取用户数据(hEle2)
	// 释放当前对象关联的动画
	for i := len(list_animation) - 1; i >= 0; i-- {
		hObjectUI := xc.X动画_取UI对象(list_animation[i])
		if hEle == hObjectUI || hEle2 == hObjectUI {
			xc.X动画_释放(list_animation[i], false)
			list_animation = append(list_animation[:i], list_animation[i+1:]...)
		}
	}

	hAnimation := xc.X动画_创建动画序列(hEle2, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_运行(hAnimation, hEle2)
	xc.X动画_透明度EX(hAnimation, 1000, 255, 0, 1, 0, false)
	xc.X动画_显示(hAnimation, 0, false)

	xc.X元素_设置透明度(hEle, 0)
	xc.X窗口组件_显示(hEle, true)

	hAnimation = xc.X动画_创建动画序列(hEle, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_运行(hAnimation, hEle)
	xc.X动画_延迟(hAnimation, 500)
	xc.X动画_透明度EX(hAnimation, 1000, 0, 255, 1, 0, false)
	return 0
}

// 10.图片切换2 - 滚动切换
func OnBtnClick10(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 150
	var top int32 = 50

	imgMap := map[int][]byte{
		1: img1,
		2: img2,
		3: img3,
		4: img4,
		5: img5,
		6: img6,
	}

	for i := 0; i < 3; i++ {
		hEle := xc.X元素_创建(left, top, 211, 270, w.X句柄)
		xc.X元素_启用绘制边框(hEle, false)
		list_xcgui = append(list_xcgui, hEle)

		hImage := xc.X图片_加载从内存(imgMap[i*2+1])
		xc.X图片_设置绘制类型(hImage, xcc.X图片绘制类型_固定比例)

		hImage2 := xc.X图片_加载从内存(imgMap[i*2+2])
		xc.X图片_设置绘制类型(hImage2, xcc.X图片绘制类型_固定比例)

		hShapePic := xc.X形状图片_创建(0, 0, 211, 270, hEle)
		xc.X形状图片_设置图片(hShapePic, hImage)

		hShapePic2 := xc.X形状图片_创建(211+10, 0, 211, 270, hEle)
		xc.X形状图片_设置图片(hShapePic2, hImage2)

		hText := xc.X形状文本_创建(left, top+280, 200, 40, "炫彩界面库-图片切换2\r\n$66.66", w.X句柄)
		xc.X形状文本_设置文本颜色(hText, xc.RGBA颜色(80, 80, 80, 255))
		list_xcgui = append(list_xcgui, hText)

		xc.X元素_注册事件C1(hEle, xcc.X元素事件_鼠标_进入, OnMouseStay10)
		xc.X元素_注册事件C1(hEle, xcc.X元素事件_鼠标_离开, OnMouseLeave10)

		left += 211 + 10
	}
	w.X重绘(false)
	return 0
}

// 鼠标进入事件10
func OnMouseStay10(hEle int, pbHandled *bool) int {
	// 释放当前对象关联的动画
	for i := len(list_animation) - 1; i >= 0; i-- {
		hObjectUI := xc.X动画_取UI对象(list_animation[i])
		if hEle == hObjectUI {
			xc.X动画_释放(list_animation[i], false)
			list_animation = append(list_animation[:i], list_animation[i+1:]...)
		}
	}

	hPic := xc.X元素_取子对象从索引(hEle, 0)

	hAnimation := xc.X动画_创建动画序列(hPic, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_运行(hAnimation, hEle)
	xc.X动画_移动(hAnimation, 500, -(211 + 10), 0, 1, xcc.X缓动标识_三次方|xcc.X缓动标识_慢到快, false)

	hPic = xc.X元素_取子对象从索引(hEle, 1)

	hAnimation = xc.X动画_创建动画序列(hPic, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_运行(hAnimation, hEle)
	xc.X动画_移动(hAnimation, 500, 0, 0, 1, xcc.X缓动标识_三次方|xcc.X缓动标识_慢到快, false)
	return 0
}

// 鼠标离开事件10
func OnMouseLeave10(hEle, hEleStay int, pbHandled *bool) int {
	// 释放当前对象关联的动画
	for i := len(list_animation) - 1; i >= 0; i-- {
		hObjectUI := xc.X动画_取UI对象(list_animation[i])
		if hEle == hObjectUI {
			xc.X动画_释放(list_animation[i], false)
			list_animation = append(list_animation[:i], list_animation[i+1:]...)
		}
	}

	hPic := xc.X元素_取子对象从索引(hEle, 0)

	hAnimation := xc.X动画_创建动画序列(hPic, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_运行(hAnimation, hEle)
	xc.X动画_移动(hAnimation, 500, 0, 0, 1, xcc.X缓动标识_三次方|xcc.X缓动标识_慢到快, false)

	hPic = xc.X元素_取子对象从索引(hEle, 1)

	hAnimation = xc.X动画_创建动画序列(hPic, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_运行(hAnimation, hEle)
	xc.X动画_移动(hAnimation, 500, 211+10, 0, 1, xcc.X缓动标识_三次方|xcc.X缓动标识_慢到快, false)
	return 0
}

// 11.进度 等待
func OnBtnClick11(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 160
	var top int32 = 80
	var hSvg, hGroup, hAnimation int

	// 两个球型交替移动
	{
		hSvg := xc.SVG_加载从文本W(svg11)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)

		hGroup := xc.X动画组_创建(0)
		list_animation = append(list_animation, hGroup)
		xc.X动画_运行(hGroup, w.X句柄)

		hAnimation := xc.X动画_创建动画序列(hSvg, 1)
		xc.X动画组_添加项(hGroup, hAnimation)
		xc.X动画_移动(hAnimation, 1000, float32(left)+50, float32(top), 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, false)
		xc.X动画_移动(hAnimation, 1000, float32(left), float32(top), 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, false)

		hSvg = xc.SVG_加载从文本W(svg12)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left+50, top)

		hGroup = xc.X动画组_创建(0)
		list_animation = append(list_animation, hGroup)
		xc.X动画_运行(hGroup, w.X句柄)

		hAnimation = xc.X动画_创建动画序列(hSvg, 1)
		xc.X动画组_添加项(hGroup, hAnimation)
		xc.X动画_移动(hAnimation, 1000, float32(left), float32(top), 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, false)
		xc.X动画_移动(hAnimation, 1000, float32(left)+50, float32(top), 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, false)
	}

	// 一排小球 缩放
	{
		left = 350
		hGroup = xc.X动画组_创建(0)
		list_animation = append(list_animation, hGroup)
		xc.X动画_运行(hGroup, w.X句柄)

		for i := 0; i < 10; i++ {
			hSvg = xc.SVG_加载从文本W(svg13)
			list_svg = append(list_svg, hSvg)
			xc.SVG_设置偏移(hSvg, left+int32(i)*50, top)

			hAnimation = xc.X动画_创建动画序列(hSvg, 0)
			xc.X动画组_添加项(hGroup, hAnimation)

			xc.X动画_延迟(hAnimation, float32(i)*200)
			xc.X动画_缩放(hAnimation, 1000, 2, 2, 1, 0, true)
		}
	}

	// 一排小球 垂直缩放
	{
		top = 150
		hGroup = xc.X动画组_创建(0)
		list_animation = append(list_animation, hGroup)
		xc.X动画_运行(hGroup, w.X句柄)

		for i := 0; i < 10; i++ {
			hSvg = xc.SVG_加载从文本W(svg13)
			list_svg = append(list_svg, hSvg)
			xc.SVG_设置偏移(hSvg, left+int32(i)*50, top)

			hAnimation = xc.X动画_创建动画序列(hSvg, 0)
			xc.X动画组_添加项(hGroup, hAnimation)

			xc.X动画_延迟(hAnimation, float32(i)*200)
			xc.X动画_缩放(hAnimation, 1000, 1, 2, 1, 0, true)
		}
	}

	// 一排小球 上下波浪
	{
		left = 150
		top = 200
		for i := 0; i < 10; i++ {
			hSvg = xc.SVG_加载从文本W(svg13)
			list_svg = append(list_svg, hSvg)
			x := left + int32(i)*35
			xc.SVG_设置偏移(hSvg, x, top)

			hAnimation = xc.X动画_创建动画序列(hSvg, 0)
			list_animation = append(list_animation, hAnimation)
			xc.X动画_运行(hAnimation, w.X句柄)

			xc.X动画项_启用完成释放(xc.X动画_延迟(hAnimation, float32(i)*100), true)
			xc.X动画_移动(hAnimation, 1200, float32(x), float32(top)+100, 1, 0, true)
		}
	}

	// 一排小球上下波浪
	{
		left = 550
		for i := 0; i < 10; i++ {
			hSvg = xc.SVG_加载从文本W(svg13)
			list_svg = append(list_svg, hSvg)
			x := left + int32(i)*35
			xc.SVG_设置偏移(hSvg, x, top)

			hAnimation = xc.X动画_创建动画序列(hSvg, 0)
			list_animation = append(list_animation, hAnimation)
			xc.X动画_运行(hAnimation, w.X句柄)

			xc.X动画项_启用完成释放(xc.X动画_延迟(hAnimation, float32(i)*150), true)
			xc.X动画_移动(hAnimation, 1000, float32(x), float32(top)+50, 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, true)
		}
	}

	// 一排小球 跳动
	{
		left = 150
		top = 350
		for i := 0; i < 10; i++ {
			hSvg = xc.SVG_加载从文本W(svg13)
			list_svg = append(list_svg, hSvg)
			x := left + int32(i)*35
			xc.SVG_设置偏移(hSvg, x, top)

			hAnimation = xc.X动画_创建动画序列(hSvg, 0)
			list_animation = append(list_animation, hAnimation)
			xc.X动画_运行(hAnimation, w.X句柄)

			xc.X动画项_启用完成释放(xc.X动画_延迟(hAnimation, float32(i)*200), true)
			xc.X动画_移动(hAnimation, 500, float32(x), float32(top)+50, 1, xcc.X缓动标识_五次方|xcc.X缓动标识_快到慢, true)
			xc.X动画_延迟(hAnimation, 1700)
		}
	}

	// 一排小球 移动
	{
		left = 220
		top = 600
		for i := 5; i >= 0; i-- {
			hSvg = xc.SVG_加载从文本W(svg14)
			list_svg = append(list_svg, hSvg)
			xc.SVG_设置偏移(hSvg, 100-int32(i)*25, top)
			xc.SVG_设置透明度(hSvg, 0)

			{
				hAnimation = xc.X动画_创建动画序列(hSvg, 0)
				xc.X动画_运行(hAnimation, w.X句柄)
				list_animation = append(list_animation, hAnimation)

				xc.X动画项_启用完成释放(xc.X动画_延迟(hAnimation, float32(i)*100), true)
				xc.X动画_移动(hAnimation, 2000, 550-float32(i)*25, float32(top), 1, xcc.X缓动标识_二次方|xcc.X缓动标识_快到慢, false)
				xc.X动画_移动(hAnimation, 2000, 900-float32(i)*25, float32(top), 1, xcc.X缓动标识_二次方|xcc.X缓动标识_慢到快, false)
				xc.X动画_移动(hAnimation, 0, 100-float32(i)*25, float32(top), 1, 0, false)
				xc.X动画_延迟(hAnimation, 500)
			}
			{
				hAnimation = xc.X动画_创建动画序列(hSvg, 0)
				xc.X动画_运行(hAnimation, w.X句柄)
				list_animation = append(list_animation, hAnimation)

				xc.X动画项_启用完成释放(xc.X动画_延迟(hAnimation, float32(i)*100), true)
				xc.X动画_透明度EX(hAnimation, 2000, 0, 255, 1, xcc.X缓动标识_二次方|xcc.X缓动标识_快到慢, false)
				xc.X动画_透明度EX(hAnimation, 2000, 255, 0, 1, xcc.X缓动标识_二次方|xcc.X缓动标识_慢到快, false)
				xc.X动画_延迟(hAnimation, 500)
			}
		}
	}
	w.X重绘(false)
	return 0
}

// 12.旋转 移动
func OnBtnClick12(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 120
	var top int32 = 100
	var hSvg, hAnimation int

	// 移动 360度旋转
	{
		hSvg := xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, 0)

		hAnimation := xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_旋转(hAnimation, 1700, 360, 1, 0, false)
		xc.X动画_运行(hAnimation, w.X句柄)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_移动(hAnimation, 3000, float32(left)+500, float32(top), 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}

	// 移动 往返旋转
	{
		top = 350
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, -45)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 0, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_旋转(hAnimation, 1500, 45, 1, xcc.X缓动标识_二次方|xcc.X缓动标识_慢到快, false)
		xc.X动画_旋转(hAnimation, 1500, -45, 1, xcc.X缓动标识_二次方|xcc.X缓动标识_慢到快, false)
		xc.X动画_运行(hAnimation, w.X句柄)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_移动(hAnimation, 3000, float32(left)+500, float32(top), 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	return 0
}

// 13.旋转 摇摆
func OnBtnClick13(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 130
	var top int32 = 80
	var hSvg, hAnimation, hRotate int

	// 自身 摇摆 往返
	{
		hSvg := xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, -45)

		hAnimation := xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_旋转(hAnimation, 1000, 45, 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}

	// 自身 旋转
	{
		left = 500
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_旋转(hAnimation, 1000, 360, 1, xcc.X缓动标识_突击|xcc.X缓动标识_慢到快, false)
		xc.X动画_旋转(hAnimation, 0, 0, 1, xcc.X缓动标识_线性, false)
		xc.X动画_运行(hAnimation, w.X句柄)
	}

	// 两个叠加 悬挂摆动
	{
		left = 300
		top = 250
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, 45)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hRotate := xc.X动画_旋转(hAnimation, 3000, 100, 1, xcc.X缓动标识_二次方|xcc.X缓动标识_慢到快再到慢, true)
		xc.X动画旋转_设置中心(hRotate, float32(left)+10, float32(top)+50, false)
		xc.X动画_运行(hAnimation, w.X句柄)

		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, 45)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 0, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hRotate = xc.X动画_旋转(hAnimation, 3000, 100, 1, xcc.X缓动标识_三次方|xcc.X缓动标识_慢到快再到慢, true)
		xc.X动画旋转_设置中心(hRotate, float32(left)+10, float32(top)+50, false)
		xc.X动画_运行(hAnimation, w.X句柄)
	}

	// 砍东西效果
	{
		left = 500
		top = 400
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, -45)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 0, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hRotate = xc.X动画_旋转(hAnimation, 1500, 0, 1, xcc.X缓动标识_突击|xcc.X缓动标识_慢到快, true)
		xc.X动画旋转_设置中心(hRotate, float32(left), float32(top), false)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	return 0
}

// 14.旋转 移动 缩放
func OnBtnClick14(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 130
	var top int32 = 50

	// 加载svg, 设置大小和填充颜色
	hSvg := xc.SVG_加载从文本W(svg7)
	list_svg = append(list_svg, hSvg)
	xc.SVG_设置大小(hSvg, 50, 50)
	xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 0, 0, 255), true)

	// 移动 360度旋转
	xc.SVG_设置偏移(hSvg, left, top)
	xc.SVG_设置旋转角度(hSvg, 0)

	// 创建动画组
	hGroup := xc.X动画组_创建(0)
	list_animation = append(list_animation, hGroup)

	// 旋转
	hAnimation := xc.X动画_创建动画序列(hSvg, 0)
	xc.X动画组_添加项(hGroup, hAnimation)
	xc.X动画_旋转(hAnimation, 600, 360, 4, 0, false)

	// 缩放
	hAnimation = xc.X动画_创建动画序列(hSvg, 0)
	xc.X动画组_添加项(hGroup, hAnimation)
	xc.X动画_缩放(hAnimation, 2400, 7, 7, 1, 0, false)
	xc.X动画_延迟(hAnimation, 1000)
	xc.X动画_缩放(hAnimation, 1000, 1.0/7.0, 1.0/7.0, 1, 0, false)

	// 移动
	hAnimation = xc.X动画_创建动画序列(hSvg, 0)
	xc.X动画组_添加项(hGroup, hAnimation)
	xc.X动画_移动(hAnimation, 2400, float32(left)+500, float32(top)+300, 1, 0, false)
	xc.X动画_延迟(hAnimation, 1000)
	xc.X动画_移动(hAnimation, 1000, float32(left), float32(top), 1, 0, false)
	xc.X动画_运行(hGroup, w.X句柄)
	return 0
}

// 15.旋转 开合效果
func OnBtnClick15(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 150
	var top int32 = 200
	var height, width int32
	var hSvg, hAnimation, hRotate int

	// 砍东西效果
	{
		hSvg := xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		height = xc.SVG_取高度(hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, -45)

		hAnimation := xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hRotate := xc.X动画_旋转(hAnimation, 2000, 0, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, true)
		xc.X动画旋转_设置中心(hRotate, float32(left), float32(top+height/2.0), false)
		xc.X动画_运行(hAnimation, w.X句柄)
	}

	// 砍东西效果
	{
		top = 300
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		height = xc.SVG_取高度(hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, 45)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hRotate = xc.X动画_旋转(hAnimation, 2000, 0, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, true)
		xc.X动画旋转_设置中心(hRotate, float32(left), float32(top+height/2.0), false)
		xc.X动画_运行(hAnimation, w.X句柄)
	}

	// 砍东西效果
	{
		left = 500
		top = 200
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		width = xc.SVG_取宽度(hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, 45)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 0, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hRotate = xc.X动画_旋转(hAnimation, 2000, 0, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, true)
		xc.X动画旋转_设置中心(hRotate, float32(left+width), float32(top+height/2.0), false)
		xc.X动画_运行(hAnimation, w.X句柄)
	}

	// 砍东西效果
	{
		top = 300
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		width = xc.SVG_取宽度(hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置旋转角度(hSvg, -45)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 0, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hRotate = xc.X动画_旋转(hAnimation, 2000, 0, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, true)
		xc.X动画旋转_设置中心(hRotate, float32(left+width), float32(top+height/2.0), false)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	return 0
}

// 16.颜色渐变
func OnBtnClick16(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 150
	var top int32 = 50
	var hSvg, hAnimation int

	{
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 0, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_颜色(hAnimation, 1500, xc.RGBA颜色(0, 0, 255, 255), 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top = 225
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(0, 255, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_颜色(hAnimation, 1500, xc.RGBA颜色(255, 0, 0, 255), 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top = 400
		hSvg = xc.SVG_加载从文本W(svg7)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 255, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_颜色(hAnimation, 1500, xc.RGBA颜色(0, 0, 255, 255), 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		hSvg = xc.SVG_加载从文本(svg15)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, 500, 300)
		xc.SVG_设置用户填充颜色(hSvg, xc.RGBA颜色(255, 255, 0, 255), true)

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_颜色(hAnimation, 1500, xc.RGBA颜色(0, 255, 255, 255), 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		hFontx := xc.X字体_创建EX("微软雅黑", 36, xcc.X字体样式_粗体)
		hShapeText := xc.X形状文本_创建(500, 100, 400, 50, "炫彩界面库", w.X句柄)
		xc.X窗口组件_布局项_设置宽度(hShapeText, xcc.X布局大小类型_自动大小, -1) // 自动宽度
		list_xcgui = append(list_xcgui, hShapeText)
		xc.X形状文本_设置字体(hShapeText, hFontx)
		xc.X形状文本_设置文本颜色(hShapeText, xc.RGBA颜色(255, 0, 0, 255))

		hAnimation = xc.X动画_创建动画序列(hShapeText, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_颜色(hAnimation, 1500, xc.RGBA颜色(0, 0, 255, 255), 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		hShapeText := xc.X形状文本_创建(500, 200, 100, 20, "炫彩界面库", w.X句柄)
		xc.X窗口组件_布局项_设置宽度(hShapeText, xcc.X布局大小类型_自动大小, -1) // 自动宽度
		list_xcgui = append(list_xcgui, hShapeText)

		hAnimation = xc.X动画_创建动画序列(hShapeText, 0)
		list_animation = append(list_animation, hAnimation)
		xc.X动画_颜色(hAnimation, 1500, xc.RGBA颜色(0, 255, 0, 255), 1, 0, true)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	return 0
}

// 17.缩放 位置
func OnBtnClick17(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 150
	var top int32 = 50
	var hSvg, hAnimation, hScale int

	{
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_leftTop", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_左上角)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top += 150
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_left", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_左)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top += 150
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_leftBottom", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_左下角)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top = 50
		left += 150
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_top", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_上)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top += 150
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_center", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_中心)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top += 150
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_bottom", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_下)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		left += 150
		top = 50
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_rightTop", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_右上角)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top += 150
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_right", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.Position_Flag_Right)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	{
		top += 150
		hSvg = xc.SVG_加载从文本W(svg5)
		list_svg = append(list_svg, hSvg)
		xc.SVG_设置偏移(hSvg, left, top)
		list_xcgui = append(list_xcgui, xc.X形状文本_创建(left, top+65, 150, 20, "position_flag_rightBottom", w.X句柄))

		hAnimation = xc.X动画_创建动画序列(hSvg, 0)
		list_animation = append(list_animation, hAnimation)
		hScale = xc.X动画_缩放(hAnimation, 3000, 0.5, 0.5, 1, 0, true)
		xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_右下角)
		xc.X动画_运行(hAnimation, w.X句柄)
	}
	return 0
}

// 18.按钮 宽度
func OnBtnClick18(pbHandled *bool) int {
	ReleaseAnimation()
	var left int32 = 150
	var top int32 = 50
	var hFont = font.X创建(10).X句柄

	for i := 0; i < 5; i++ {
		hButton := xc.X按钮_创建(left, top, 100, 50, "鼠标 停留 离开", w.X句柄)
		list_xcgui = append(list_xcgui, hButton)
		xc.X元素_设置字体(hButton, hFont)
		xc.X元素_设置文本颜色(hButton, xc.RGBA颜色(255, 255, 255, 255))
		xc.X背景_设置内容(xc.X元素_取背景管理器(hButton), "{99:1.9.9;98:16(0)32(1)64(2);5:2(15)20(1)21(3)26(1)22(-25024)23(255)9(4,4,4,4);5:2(15)20(1)21(3)26(1)22(-20122)23(255)9(4,4,4,4);5:2(15)20(1)21(3)26(1)22(-1667526)23(255)9(4,4,4,4);}")

		xc.X元素_注册事件C1(hButton, xcc.X元素事件_鼠标_进入, OnMouseStay18)
		xc.X元素_注册事件C1(hButton, xcc.X元素事件_鼠标_离开, OnMouseLeave18)
		top += 60
	}
	w.X重绘(false)
	return 0
}

// 鼠标进入事件18
func OnMouseStay18(hButton int, pbHandled *bool) int {
	// 释放当前对象关联的动画
	for i := len(list_animation) - 1; i >= 0; i-- {
		hObjectUI := xc.X动画_取UI对象(list_animation[i])
		if hButton == hObjectUI {
			xc.X动画_释放(list_animation[i], false)
			list_animation = append(list_animation[:i], list_animation[i+1:]...)
		}
	}

	hAnimation := xc.X动画_创建动画序列(hButton, 1)
	list_animation = append(list_animation, hAnimation)
	hScale := xc.X动画_缩放大小(hAnimation, 400, 250, 40, 1, xcc.X缓动标识_二次方|xcc.X缓动标识_快到慢, false)
	xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_左)
	xc.X动画_运行(hAnimation, w.X句柄)
	return 0
}

// 鼠标离开事件18
func OnMouseLeave18(hButton, hEleStay int, pbHandled *bool) int {
	// 释放当前对象关联的动画
	for i := len(list_animation) - 1; i >= 0; i-- {
		hObjectUI := xc.X动画_取UI对象(list_animation[i])
		if hButton == hObjectUI {
			xc.X动画_释放(list_animation[i], false)
			list_animation = append(list_animation[:i], list_animation[i+1:]...)
		}
	}

	hAnimation := xc.X动画_创建动画序列(hButton, 1)
	list_animation = append(list_animation, hAnimation)
	hScale := xc.X动画_缩放大小(hAnimation, 400, 150, 40, 1, xcc.X缓动标识_二次方|xcc.X缓动标识_慢到快, false)
	xc.X动画缩放_设置延伸位置(hScale, xcc.X位置标识_左)
	xc.X动画_运行(hAnimation, w.X句柄)
	return 0
}

// 19.窗口特效
func OnBtnClick19(pbHandled *bool) int {
	ReleaseAnimation()
	var top int32 = 200
	var left int32 = 140
	var width int32 = 120
	var height_btn int32 = 35
	var height int32 = 34

	btn := CreateButton(left, top, width, height_btn, "窗口 从上往下")
	top += height
	list_xcgui = append(list_xcgui, btn.X句柄)
	btn.X事件_被单击(OnBtnClick19_1)

	btn = CreateButton(left, top, width, height_btn, "窗口 从左往右")
	top += height
	list_xcgui = append(list_xcgui, btn.X句柄)
	btn.X事件_被单击(OnBtnClick19_2)

	btn = CreateButton(left, top, width, height_btn, "窗口 缩放")
	top += height
	list_xcgui = append(list_xcgui, btn.X句柄)
	btn.X事件_被单击(OnBtnClick19_3)

	btn = CreateButton(left, top, width, height_btn, "窗口 缩放2")
	top += height
	list_xcgui = append(list_xcgui, btn.X句柄)
	btn.X事件_被单击(OnBtnClick19_4)

	btn = CreateButton(left, top, width, height_btn, "窗口 透明")
	top += height
	list_xcgui = append(list_xcgui, btn.X句柄)
	btn.X事件_被单击(OnBtnClick19_5)

	w.X重绘(false)
	return 0
}

// 19.1 窗口缓动 从上往下
func OnBtnClick19_1(pbHandled *bool) int {
	m := window.X创建模态窗口(400, 300, "窗口缓动", w.X取HWND句柄(), xcc.X窗口样式_模态窗口|xcc.X窗口样式_拖动窗口)

	rcWindow := w.GetRectDPI()
	rcModal := m.GetRectDPI()
	left := float32(rcWindow.X左 + (rcWindow.X右-rcWindow.X左-(rcModal.X右-rcModal.X左))/2)
	top := float32(rcWindow.X上 + (rcWindow.X下-rcWindow.X上-(rcModal.X下-rcModal.X上))/2)

	hAnimation := xc.X动画_创建动画序列(m.X句柄, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_移动EX(hAnimation, 1000, left, 20, left, top, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
	xc.X动画_运行(hAnimation, m.X句柄)

	m.X启动()
	return 0
}

// 19.2 窗口缓动 从左往右
func OnBtnClick19_2(pbHandled *bool) int {
	m := window.X创建模态窗口(400, 300, "窗口缓动", w.X取HWND句柄(), xcc.X窗口样式_模态窗口|xcc.X窗口样式_拖动窗口)

	rcWindow := w.GetRectDPI()
	rcModal := m.GetRectDPI()
	left := float32(rcWindow.X左 + (rcWindow.X右-rcWindow.X左-(rcModal.X右-rcModal.X左))/2)
	top := float32(rcWindow.X上 + (rcWindow.X下-rcWindow.X上-(rcModal.X下-rcModal.X上))/2)

	hAnimation := xc.X动画_创建动画序列(m.X句柄, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_移动EX(hAnimation, 1000, 20, top, left, top, 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
	xc.X动画_运行(hAnimation, m.X句柄)

	m.X启动()
	return 0
}

// 19.3 窗口缩放
func OnBtnClick19_3(pbHandled *bool) int {
	m := window.X创建模态窗口(400, 300, "窗口缩放", w.X取HWND句柄(), xcc.X窗口样式_模态窗口|xcc.X窗口样式_拖动窗口)

	rcModal := m.X取坐标EX()
	fmt.Println(rcModal)
	width := rcModal.X右 - rcModal.X左
	height := rcModal.X下 - rcModal.X上

	hAnimation := xc.X动画_创建动画序列(m.X句柄, 1)
	list_animation = append(list_animation, hAnimation)

	// TODO: 这里有个BUG, 导致窗口位置被改变了, 不应该改变才对, 是开启AutoDPI后出现的BUG
	xc.X动画_缩放大小(hAnimation, 1000, float32(width)*1.5, float32(height)*1.5, 1, xcc.X缓动标识_二次方|xcc.X缓动标识_慢到快, true)
	xc.X动画_运行(hAnimation, m.X句柄)

	rcModal = m.X取坐标EX()
	fmt.Println(rcModal)
	m.X启动()
	return 0
}

// 19.4 窗口缩放2
func OnBtnClick19_4(pbHandled *bool) int {
	m := window.X创建模态窗口(400, 300, "窗口缩放2", w.X取HWND句柄(), xcc.X窗口样式_模态窗口|xcc.X窗口样式_拖动窗口)

	rcModal := m.X取坐标EX()
	width := rcModal.X右 - rcModal.X左
	height := rcModal.X下 - rcModal.X上

	hAnimation := xc.X动画_创建动画序列(m.X句柄, 1)
	list_animation = append(list_animation, hAnimation)

	// TODO: 这里有个BUG, 导致窗口位置被改变了, 不应该改变才对, 是开启AutoDPI后出现的BUG
	xc.X动画_缩放大小(hAnimation, 1000, float32(width)*2, float32(height)*2, 1, xcc.X缓动标识_回弹|xcc.X缓动标识_快到慢, false)

	xc.X动画_运行(hAnimation, m.X句柄)
	m.X启动()
	return 0
}

// 19.5 窗口透明
func OnBtnClick19_5(pbHandled *bool) int {
	hModal := xc.X模态窗口_创建(400, 300, "窗口透明", w.X取HWND句柄(), xcc.X窗口样式_模态窗口|xcc.X窗口样式_拖动窗口)
	xc.X窗口_设置透明类型(hModal, xcc.X窗口透明标识_阴影窗口)
	xc.X窗口_设置透明度(hModal, 1)

	hAnimation := xc.X动画_创建动画序列(hModal, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_延迟(hAnimation, 100)
	xc.X动画_透明度(hAnimation, 1000, 255, 1, 0, false)
	xc.X动画_运行(hAnimation, hModal)

	xc.X模态窗口_启动(hModal)
	return 0
}

// 20. 遮盖弹窗
func OnBtnClick20(pbHandled *bool) int {
	ReleaseAnimation()
	var top int32 = 200
	var left int32 = 140
	var width int32 = 150
	var height_btn int32 = 35
	var height int32 = 34

	hButton := CreateButton(left, top, width, height_btn, "遮盖层-内嵌子弹窗").X句柄
	top += height
	list_xcgui = append(list_xcgui, hButton)
	xc.X元素_注册事件C(hButton, xcc.X元素事件_按钮_点击, OnBtnClick20_1)

	hButton = CreateButton(left, top, width, height_btn, "遮盖层-内嵌消息框").X句柄
	top += height
	list_xcgui = append(list_xcgui, hButton)
	xc.X元素_注册事件C(hButton, xcc.X元素事件_按钮_点击, OnBtnClick20_2)

	hButton = CreateButton(left, top, width, height_btn, "遮盖层-消息框").X句柄
	top += height
	list_xcgui = append(list_xcgui, hButton)
	xc.X元素_注册事件C(hButton, xcc.X元素事件_按钮_点击, OnBtnClick20_3)

	hButton = CreateButton(left, top, width, height_btn, "遮盖层-等待").X句柄
	top += height
	list_xcgui = append(list_xcgui, hButton)
	xc.X元素_注册事件C(hButton, xcc.X元素事件_按钮_点击, OnBtnClick20_4)

	hButton = CreateButton(left, top, width, height_btn, "遮盖层-基础元素弹窗").X句柄
	top += height
	list_xcgui = append(list_xcgui, hButton)
	xc.X元素_注册事件C(hButton, xcc.X元素事件_按钮_点击, OnBtnClick20_5)

	w.X重绘(false)
	return 0
}

var hEle_mask int // 遮罩

// 20.1 遮盖层 内嵌子弹窗
func OnBtnClick20_1(pbHandled *bool) int {
	var rect xc.X结构_矩形
	w.X取Body坐标(&rect)

	xc.X启用DPI(false)
	hEle_mask = xc.X元素_创建(rect.X左, rect.X上, rect.X右-rect.X左, rect.X下-rect.X上, w.X句柄)
	xc.X启用DPI(true)

	xc.X元素_添加背景填充(hEle_mask, xcc.X组合状态(xcc.X窗口状态_整个窗口), xc.RGBA颜色(0, 0, 0, 200))
	xc.X元素_重绘(hEle_mask, true)

	hWindow_ := xc.X窗口_创建EX(0, xcc.WS_CHILD, "", 0, 0, 300, 200, "内嵌子弹窗", w.X取HWND句柄(), xcc.X窗口样式_默认样式)

	xc.X窗口_显示(hWindow_, true)
	xc.X窗口_注册事件C(hWindow_, xcc.X窗口事件_窗口_销毁, OnWndDestroy20)
	return 0
}

func OnWndDestroy20(pbHandled *bool) int {
	if hEle_mask != 0 {
		xc.X元素_销毁(hEle_mask)
		hEle_mask = 0
		w.X重绘(false)
	}
	return 0
}

// 20.2 遮盖层 内嵌消息框
func OnBtnClick20_2(pbHandled *bool) int {
	var rect xc.X结构_矩形
	w.X取Body坐标(&rect)

	xc.X启用DPI(false)
	hEle_mask = xc.X元素_创建(rect.X左, rect.X上, rect.X右-rect.X左, rect.X下-rect.X上, w.X句柄)
	xc.X启用DPI(true)

	xc.X元素_添加背景填充(hEle_mask, xcc.X组合状态(xcc.X窗口状态_整个窗口), xc.RGBA颜色(0, 0, 0, 200))
	xc.X元素_重绘(hEle_mask, true)

	hWindow_ := xc.X消息框_创建EX(0, 0x40000000, "", "标题", "内嵌消息框", xcc.X消息框_确定按钮|xcc.X消息框_信息图标, w.X取HWND句柄(), xcc.X窗口样式_默认样式)

	xc.X窗口_显示(hWindow_, true)
	xc.X窗口_注册事件C(hWindow_, xcc.X窗口事件_窗口_销毁, OnWndDestroy20)
	return 0
}

// 20.3 遮盖层 消息框
func OnBtnClick20_3(pbHandled *bool) int {
	var rect xc.X结构_矩形
	w.X取Body坐标(&rect)

	xc.X启用DPI(false)
	hEle_mask = xc.X元素_创建(rect.X左, rect.X上, rect.X右-rect.X左, rect.X下-rect.X上, w.X句柄)
	xc.X启用DPI(true)

	xc.X元素_添加背景填充(hEle_mask, xcc.X组合状态(xcc.X窗口状态_整个窗口), xc.RGBA颜色(0, 0, 0, 200))
	xc.X元素_重绘(hEle_mask, true)

	hWindow_ := xc.X消息框_创建("标题", "消息框", xcc.X消息框_确定按钮|xcc.X消息框_信息图标, w.X取HWND句柄(), xcc.X窗口样式_默认样式)

	xc.X窗口_显示(hWindow_, true)
	xc.X窗口_注册事件C(hWindow_, xcc.X窗口事件_窗口_销毁, OnWndDestroy20)
	return 0
}

var hSvg1, hSvg2 int

// 20.4 遮盖层 等待
func OnBtnClick20_4(pbHandled *bool) int {
	const str = `<svg x="0" y="0" width="25" height="25" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#ee6362" /></svg>`
	const str2 = `<svg x="0" y="0" width="25" height="25" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#2cb0b2" /></svg>`

	hSvg1 = xc.SVG_加载从文本W(str)
	hSvg2 = xc.SVG_加载从文本W(str2)

	var rect xc.X结构_矩形
	w.X取Body坐标(&rect)

	xc.X启用DPI(false)
	hEle_mask = xc.X元素_创建(rect.X左, rect.X上, rect.X右-rect.X左, rect.X下-rect.X上, w.X句柄)
	xc.X启用DPI(true)

	xc.X元素_添加背景填充(hEle_mask, xcc.X组合状态(xcc.X窗口状态_整个窗口), xc.RGBA颜色(0, 0, 0, 200))
	xc.X元素_重绘(hEle_mask, true)

	xc.X元素_注册事件C1(hEle_mask, xcc.X元素事件_绘制, OnDraw20_4and5)
	xc.X元素_注册事件C1(hEle_mask, xcc.X元素事件_鼠标_左键按下, OnLButtonDown20_4and5)

	left := rect.X左 + (rect.X右-rect.X左-100)/2
	top := (rect.X下-rect.X上)/2 - 50
	xc.X形状文本_设置文本颜色(xc.X形状文本_创建(left, top-25, 100, 20, "正在加载...", hEle_mask), xc.RGBA颜色(255, 255, 255, 255))

	// 两个球型交替移动
	{
		xc.SVG_设置偏移(hSvg1, left, top)

		hGroup := xc.X动画组_创建(0)
		list_animation = append(list_animation, hGroup)
		xc.X动画_运行(hGroup, w.X句柄)

		hAnimation := xc.X动画_创建动画序列(hSvg1, 1)
		xc.X动画组_添加项(hGroup, hAnimation)
		xc.X动画_移动(hAnimation, 1000, float32(left+50), float32(top), 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, false)
		xc.X动画_移动(hAnimation, 1000, float32(left), float32(top), 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, false)

		xc.SVG_设置偏移(hSvg2, left+50, top)

		hGroup = xc.X动画组_创建(0)
		list_animation = append(list_animation, hGroup)
		xc.X动画_运行(hGroup, w.X句柄)

		hAnimation = xc.X动画_创建动画序列(hSvg2, 1)
		xc.X动画组_添加项(hGroup, hAnimation)
		xc.X动画_移动(hAnimation, 1000, float32(left), float32(top), 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, false)
		xc.X动画_移动(hAnimation, 1000, float32(left+50), float32(top), 1, xcc.X缓动标识_正弦|xcc.X缓动标识_慢到快再到慢, false)
	}
	return 0
}

func OnDraw20_4and5(hEle int, hDraw int, pbHandled *bool) int {
	*pbHandled = true
	xc.X元素_绘制(hEle, hDraw)

	xc.X绘制_SVG源(hDraw, hSvg1)
	xc.X绘制_SVG源(hDraw, hSvg2)
	return 0
}

func OnLButtonDown20_4and5(hEle int, nFlags uint32, pPt *xc.X结构_坐标, pbHandled *bool) int {
	*pbHandled = true
	xc.X元素_销毁(hEle)

	if hSvg1 != 0 {
		xc.SVG_销毁(hSvg1)
		hSvg1 = 0
	}
	if hSvg2 != 0 {
		xc.SVG_销毁(hSvg2)
		hSvg2 = 0
	}
	w.X重绘(false)
	return 0
}

// 20.5 遮盖层 基础元素弹窗
func OnBtnClick20_5(pbHandled *bool) int {
	var rect xc.X结构_矩形
	w.X取Body坐标(&rect)

	xc.X启用DPI(false)
	hEle_mask = xc.X元素_创建(rect.X左, rect.X上, rect.X右-rect.X左, rect.X下-rect.X上, w.X句柄)
	xc.X启用DPI(true)

	xc.X元素_添加背景填充(hEle_mask, xcc.X组合状态(xcc.X窗口状态_整个窗口), xc.RGBA颜色(0, 0, 0, 200))
	xc.X元素_注册事件C1(hEle_mask, xcc.X元素事件_绘制, OnDraw20_4and5)
	xc.X元素_注册事件C1(hEle_mask, xcc.X元素事件_鼠标_左键按下, OnLButtonDown20_4and5)

	var width int32 = 350
	var height int32 = 170
	left := rect.X左 + (rect.X右-rect.X左-100)/2
	top := (rect.X下-rect.X上)/2 - 50

	hEleDlg := xc.X元素_创建(left, 10, width, height, hEle_mask)
	xc.X窗口组件_显示(hEleDlg, false)
	xc.X元素_启用背景透明(hEleDlg, true)
	xc.X背景_设置内容(xc.X元素_取背景管理器(hEleDlg), "{99:1.9.9;98:1(0);5:2(15)20(1)21(3)26(1)22(-1)23(255)9(10,10,10,10);}")
	xc.X形状文本_设置文本颜色(xc.X形状文本_创建(50, 5, 220, 20, "炫彩界面库-仅作功能演示,没有美化处理", hEleDlg), xc.RGBA颜色(80, 80, 80, 255))

	hBtnClose := xc.X按钮_创建(width-40, 2, 30, 22, "", hEleDlg)
	xc.X背景_设置内容(xc.X元素_取背景管理器(hBtnClose), "{99:1.9.9;98:16(0,1)32(0,1)64(0,1);5:2(48)8(45.00)3(2,10,2,10)20(1)21(3)26(0)22(-8355712)23(255);5:2(48)8(45.00)3(10,2,100,100)20(1)21(3)26(0)22(-8355712)23(255);}")

	xc.X形状文本_设置文本颜色(xc.X形状文本_创建(20, 60, 200, 20, "请输入内容(这是一个演示)", hEleDlg), xc.RGBA颜色(80, 80, 80, 255))

	strBkm := "{99:1.9.9;98:16(0)32(1)64(1);5:2(15)20(1)21(3)26(0)22(-1)23(255)10(1)7(1)11(3)16(0)12(-3618616)13(255)9(5,5,5,5);5:2(15)20(1)21(3)26(0)22(-1)23(255)10(1)7(1)11(3)16(0)12(-17897)13(255)9(5,5,5,5);}"
	hEdit := xc.X编辑框_创建(20, 82, width-40, 26, hEleDlg)
	xc.X编辑框_设置默认文本(hEdit, "请输入内容...")
	xc.X元素_设置边框大小(hEdit, 10, 0, 10, 0)
	xc.X背景_设置内容(xc.X元素_取背景管理器(hEdit), strBkm)

	var left_ int32 = 190
	var top_ = height - 35
	hBtnOk := xc.X按钮_创建(left_, top_, 60, 22, "确定", hEleDlg)
	left_ += 80
	hBtnCancel := xc.X按钮_创建(left_, top_, 60, 22, "取消", hEleDlg)
	xc.X背景_设置内容(xc.X元素_取背景管理器(hBtnOk), strBkm)
	xc.X背景_设置内容(xc.X元素_取背景管理器(hBtnCancel), strBkm)

	xc.X元素_设置用户数据(hBtnOk, hEle_mask)
	xc.X元素_设置用户数据(hBtnClose, hEle_mask)
	xc.X元素_设置用户数据(hBtnCancel, hEle_mask)

	xc.X元素_注册事件C1(hBtnOk, xcc.X元素事件_按钮_点击, OnBtnClick20_5_close)
	xc.X元素_注册事件C1(hBtnClose, xcc.X元素事件_按钮_点击, OnBtnClick20_5_close)
	xc.X元素_注册事件C1(hBtnCancel, xcc.X元素事件_按钮_点击, OnBtnClick20_5_close)

	hAnimation := xc.X动画_创建动画序列(hEle_mask, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_透明度EX(hAnimation, 500, 0, 255, 1, 0, false)
	xc.X动画_运行(hAnimation, hEle_mask)

	hAnimation = xc.X动画_创建动画序列(hEleDlg, 1)
	list_animation = append(list_animation, hAnimation)
	xc.X动画_显示(hAnimation, 500, true)
	xc.X动画_移动(hAnimation, 500, float32(left), float32(top), 1, xcc.X缓动标识_弹跳|xcc.X缓动标识_快到慢, false)
	xc.X动画_运行(hAnimation, hEle_mask)

	w.X重绘(false)
	return 0
}

func OnBtnClick20_5_close(hEle int, pbHandled *bool) int {
	*pbHandled = true
	xc.X元素_销毁(xc.X元素_取用户数据(hEle))
	w.X重绘(false)
	return 0
}
